<template>
  <a-modal
    :title="`管理员${title}`"
    :width="800"
    destroyOnClose
    centered
    :visible="visible"
    :confirmLoading="loading"
    @ok="visible=!visible"
    @cancel="visible=!visible"
  >
    <a-card :bordered="true">
      <a-descriptions title="用户信息">
        <a-descriptions-item label="用户账号">{{ model.userCode }}</a-descriptions-item>
        <a-descriptions-item label="用户姓名">{{ model.userName }}</a-descriptions-item>
        <a-descriptions-item label="手机号码">{{ model.mobile }}</a-descriptions-item>
        <a-descriptions-item label="邮箱地址">{{ model.email }}</a-descriptions-item>
      </a-descriptions>
      <a-divider style="margin-bottom: 32px"/>
      <a-descriptions title="登录信息">
        <a-descriptions-item label="登录次数">{{ model.loginCount }}</a-descriptions-item>
        <a-descriptions-item label="错误次数">{{ model.loginErrorCount }}</a-descriptions-item>
        <a-descriptions-item label="最后登录ip">{{ model.lastLoginIp }}</a-descriptions-item>
        <a-descriptions-item label="登录锁定时间">{{ model.lockedExpiredTime }}</a-descriptions-item>
        <a-descriptions-item label="最后登录时间">{{ model.lastLoginTime }}</a-descriptions-item>
      </a-descriptions>
      <a-divider style="margin-bottom: 32px"/>
      <a-descriptions title="角色权限">
        <a-descriptions-item label="">
          <template v-if="model.roles">
            <a-tag color="blue" v-for="role in model.roles" :key="role.id">{{ role.roleName }}</a-tag>
          </template>
        </a-descriptions-item>
      </a-descriptions>
      <a-divider style="margin-bottom: 32px"/>
      <a-steps :direction="isMobile && 'vertical' || 'horizontal'" :current="2" progressDot>
        <a-step>
          <template v-slot:title>
            <span>创建时间</span>
          </template>
          <template v-slot:description>
            <div class="antd-pro-pages-profile-advanced-style-stepDescription">
              {{ model.createTime }}
            </div>
          </template>
        </a-step>
        <a-step>
          <template v-slot:title>
            <span>更新时间</span>
          </template>
          <template v-slot:description>
            <div class="antd-pro-pages-profile-advanced-style-stepDescription">
              {{ model.updateTime }}
            </div>
          </template>
        </a-step>
        <a-step>
          <template v-slot:title>
            <span>状态</span>
          </template>
          <template v-slot:description>
            <div class="antd-pro-pages-profile-advanced-style-stepDescription">
              {{ switch_state[model.state].dictValue }}
            </div>
          </template>
        </a-step>
      </a-steps>
    </a-card>
  </a-modal>
</template>
<script>
  import { baseMixin } from '@/store/app-mixin'
  import detailMixins from '@/utils/mixins/detailMixins'
  import { getInfo } from '@/api/system/admin'
  export default {
    mixins: [baseMixin, detailMixins],
    data () {
      return {
        switch_state: {}
      }
    },
    created () {
      this.getDictValue('switch_state').then(res => {
        this.switch_state = res.data
      })
    },
    methods: {
      info (record) {
        return getInfo(record)
      }
    }
  }
</script>
<style scoped>
</style>
